Most computer systems such as network servers, personal computers, PDAs, mobile phones, video games, scientific instruments, industrial robotics, medical electronics, and so on, use a storage hierarchy, in which faster but more expensive and smaller storage options are placed close to the central processing unit (CPU) while lower but larger and cheaper storage options are placed farther away from the CPU. Generally, the lower (or further away from the CPU) a storage is in the hierarchy, the less its bandwidth and the greater its access latency.
Thus, the storage in a computer system is often divided into two main categories, primary storage and secondary storage. Primary storage, often referred to simply as main memory or memory, is directly accessible to the CPU. The CPU reads instructions stored therein and executes them as required. Any data actively operated on is also stored there. Main memory is directly or indirectly connected to the CPU via a memory channel or memory bus, which is actually two buses: a control/address (C/A) bus and a data bus. The CPU or an associated memory controller firstly sends command and address via the C/A bus. It then reads or writes the data in the memory cells using the data bus. Additionally, a memory management unit (MMU), which is a small device between CPU and the main memory, recalculates the actual memory address, for example to provide an abstraction of virtual memory or other tasks.
Computer systems rely heavily on the capacity and throughput of their main memories and the speed of accessing them for optimal performance. Currently, dynamic random-access memory (DRAM) is commonly used as system or main memory. DRAM is a type of random-access memory that stores each bit of data in a separate capacitor in an integrated circuit. The capacitor can be either charged or discharged so that these two states are taken to represent the two values of a bit, conventionally called 0 and 1. Since capacitors leak charge, the information eventually fades unless the capacitor charge is refreshed periodically. Because of this refresh requirement, it is a dynamic memory as opposed to SRAM and other static memory.
The structural simplicity of DRAM allows DRAM chips to reach very high densities, because billions of transistor and capacitor pairs can fit on a single memory chip. On the other hand, DRAM is volatile memory—it loses its data quickly when power is removed. Compared to Flash memory, which is a type of electronic non-volatile computer storage medium that can be electrically erased and reprogrammed, DRAM is also much more expensive. For example, high density DRAM can cost as much as 20 times more than high-performance Flash devices.
Most computer operating systems use the concept of virtual memory, allowing utilization of more primary storage capacity than is physically available in the system. As the primary memory fills up, the system moves the least-used chunks (pages) to secondary storage devices (to a swap file or page file), retrieving them later when they are needed. As more of these retrievals from slower secondary storage are necessary, the more the overall system performance is degraded.
Secondary storage (also known as external memory or auxiliary storage), differs from primary storage in that it is not directly accessible by the CPU. The computer usually uses its input/output channels to access secondary storage and transfers the desired data using an intermediate area in the primary storage. The secondary storage does not lose the data when the device is powered down, i.e., it is non-volatile. It is also much cheaper than primary storage, typically two orders of magnitude less expensive per unit than primary storage. Modern computer systems typically have two orders of magnitude more secondary storage than primary storage and data are kept for much longer time there. Examples of secondary storage technologies include hard disk drives, flash memory (e.g. USB flash drives or keys), floppy disks, magnetic tape, paper tape, punched cards, standalone RAM disks, and Iomega Zip drives.
Secondary storage is often formatted according to a file system format, which provides the abstraction necessary to organize data into files and directories, providing also additional information (called metadata) describing the owner of a certain file, the access time, the access permissions, and other information.
Hard disk drives are commonly used as secondary storage. The time taken to access a given byte of information stored on a hard disk is typically a few thousandths of a second, or milliseconds. By contrast, the time taken to access a given byte of information stored in the main memory (e.g., random-access memory) is measured in billionths of a second, or nanoseconds. This illustrates the significant access-time difference which distinguishes solid-state memory from rotating magnetic storage devices: hard disks are typically about a million times slower than main memory. Rotating optical storage devices, such as CD and DVD drives, have even longer access times. With disk drives, once the disk read/write head reaches the proper placement and the data of interest rotates under it, subsequent data on the track are very fast to access. To reduce the seek time and rotational latency, data are transferred to and from disks in large contiguous blocks.
Most hard drives support block storage mode. Moving a block of data between main memory and secondary storage usually requires reading data from the storage or the main memory to a temporary buffer managed by the CPU, and then from the temporary buffer to where it is destined. Since the temporary buffer is typically a storage space in the DRAMs, this process usually requires the computer to move the data back and forth the memory channel multiple times. For example, moving a block of data from main memory to secondary storage may involve the steps of reading the block of data from the main memory via the memory channel, writing the block of data to the temporary buffer via the memory channel, reading the block of data from the temporary buffer via the memory channel, and storing the data into the secondary storage. Thus, it is costly, both in terms of CPU time and usage of memory channel, to move data between main memory and secondary storage.